package com.rmfyzxfw.caseprocess.model.cmd;

import com.alibaba.fastjson.JSON;
import com.rmfyzxfw.caseprocess.model.vo.ProcessNodeVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * @description:
 * @Author: GYW  742926306@qq.com
 * @Date: 2024/8/23 9:09
 */
@Data
public class ProcessConfigCmd {
    @ApiModelProperty(value ="流程id")
    @NotBlank(message = "流程id不能为空")
    private String processId;

    @ApiModelProperty(value ="流程数据id")
    private String processDataId;

    @ApiModelProperty(value ="是否发布 0否 1是")
    private Integer release = 0;

    @ApiModelProperty(value ="流程节点名称")
//    @NotEmpty(message = "流程节点不能为空")
    @Valid
    private List<ProcessNodeCmd> processNodes;

    public static void main(String[] args) {
        String s = "[{\"sort\":0,\"dataNodes\":[{\"sort\":0,\"statusId\":\"a2\",\"dataNodeId\":\"f809871fea044ce890b9bb860ccc0608\",\"dataNodeName\":\"测试\",\"dataNodeStatuses\":[{\"color\":\"green\",\"statusId\":\"a2\",\"nodeFields\":[{\"sort\":0,\"type\":1,\"logic\":1,\"fieldId\":\"90f84308a3fc4b18b90a2fc6ab1047ce\",\"groupId\":3221,\"itemName\":\"测试房产表2\",\"operator\":\">=\",\"groupSort\":0,\"tableName\":\"fc\",\"dataItemId\":\"a57fb7d15cd24b6e8221a5074d1c6b19\",\"groupLogic\":1,\"fieldNameCn\":\"编号\",\"fieldNameEn\":\"xzqhbh\",\"operationItem\":\"uwgV3gUehSLGqcmdt\",\"fieldValueType\":2,\"fieldTargetValue\":{\"value\":\"11\"},\"dynamicDataSourceId\":\"dds1\"},{\"sort\":1,\"type\":1,\"logic\":1,\"fieldId\":\"d2cf05f20cb844548b0252cd74cae90b\",\"groupId\":3221,\"itemName\":\"测试车辆表-数据\",\"operator\":\">=\",\"groupSort\":0,\"tableName\":\"cl\",\"dataItemId\":\"08f1489036e54d0ab38cf18ab0846146\",\"groupLogic\":1,\"fieldNameCn\":\"封锁时间\",\"fieldNameEn\":\"cfsj\",\"operationItem\":\"uPMGFBjHSTBUb4Rz4\",\"fieldValueType\":3,\"fieldTargetValue\":{\"value\":\"2024-10-08\"},\"dynamicDataSourceId\":\"dds1\"},{\"sort\":0,\"type\":1,\"logic\":1,\"fieldId\":\"cd65858c2d5f438e83a0014abd392a5c\",\"groupId\":6764,\"itemName\":\"测试诗文数据-列表\",\"operator\":\">\",\"groupSort\":1,\"tableName\":\"ajjb\",\"dataItemId\":\"2c9faaf24ffc46d5b197604e4a02685d\",\"groupLogic\":2,\"fieldNameCn\":\"方式\",\"fieldNameEn\":\"BQFS\",\"operationItem\":\"uPXEpwDuuandxsTBD\",\"fieldValueType\":1,\"fieldTargetValue\":{\"value\":\"11\"},\"dynamicDataSourceId\":\"dds1\"}],\"statusName\":\"正常办结\",\"statusLevel\":1,\"operationItem\":\"uTwMJq0TRoP87\",\"ruleExpression\":\"(uwgV3gUehSLGqcmdt && uPMGFBjHSTBUb4Rz4) || (uPXEpwDuuandxsTBD)\"}]},{\"sort\":1,\"statusId\":\"a4\",\"dataNodeId\":\"1831c70510f94364a6ee15fa8f74846c\",\"dataNodeName\":\"测试诗文数据6\",\"dataNodeStatuses\":[{\"color\":\"orange\",\"statusId\":\"a4\",\"nodeFields\":[{\"sort\":0,\"type\":2,\"logic\":1,\"fieldId\":\"\",\"groupId\":7773,\"operator\":\">=\",\"statusId\":\"a2\",\"groupSort\":0,\"lightDays\":22133,\"dataNodeId\":\"f809871fea044ce890b9bb860ccc0608\",\"groupLogic\":1,\"dataNodeName\":\"测试\",\"operationItem\":\"u8sdj8B8IKRSMlooB\"},{\"sort\":1,\"type\":1,\"logic\":2,\"fieldId\":\"4fa0afd9aac4415ab7ebad1ab80cf357\",\"groupId\":7773,\"itemName\":\"测试车辆表-数据\",\"operator\":\"<=\",\"groupSort\":0,\"tableName\":\"cl\",\"dataItemId\":\"08f1489036e54d0ab38cf18ab0846146\",\"groupLogic\":1,\"fieldNameCn\":\"车辆状态\",\"fieldNameEn\":\"ck\",\"operationItem\":\"u6N5K4IoH8VcQdSeu\",\"fieldValueType\":1,\"fieldTargetValue\":{\"value\":\"213132\"},\"dynamicDataSourceId\":\"dds1\"},{\"sort\":0,\"type\":1,\"logic\":1,\"fieldId\":\"d35cbfdd68504536aa69aa92bc79e50e\",\"groupId\":85,\"itemName\":\"测试诗文数据-详情\",\"operator\":\"=\",\"groupSort\":1,\"tableName\":\"cl\",\"dataItemId\":\"12f7211156ef4515a92e5bca45b11fe9\",\"groupLogic\":1,\"fieldNameCn\":\"布控时间\",\"fieldNameEn\":\"bksj\",\"operationItem\":\"u3pd2hH9b9saDFe8E\",\"fieldValueType\":3,\"fieldTargetValue\":{\"value\":\"2024-10-14\"},\"dynamicDataSourceId\":\"dds1\"}],\"statusName\":\"超期已办\",\"statusLevel\":1,\"operationItem\":\"uRxbcirojkaZy\",\"ruleExpression\":\"(u8sdj8B8IKRSMlooB || u6N5K4IoH8VcQdSeu) && (u3pd2hH9b9saDFe8E)\"}]}],\"finishAll\":false,\"processNodeId\":\"1ad89c012eeb44a4a643b93812a99f85\",\"ruleExpression\":\"uTwMJq0TRoP87&&uRxbcirojkaZy\",\"processNodeName\":\"步骤1\"},{\"sort\":1,\"dataNodes\":[{\"sort\":-1,\"statusId\":\"\",\"dataNodeId\":\"daa9f638bb26446f9d847417fef30932\",\"dataNodeName\":\"测试诗文数据8\",\"dataNodeStatuses\":[{\"color\":\"red\",\"statusId\":\"a3\",\"nodeFields\":[{\"sort\":0,\"type\":1,\"logic\":1,\"fieldId\":\"d35cbfdd68504536aa69aa92bc79e50e\",\"groupId\":8850,\"itemName\":\"测试诗文数据-详情\",\"operator\":\"<=\",\"groupSort\":0,\"tableName\":\"cl\",\"dataItemId\":\"12f7211156ef4515a92e5bca45b11fe9\",\"groupLogic\":1,\"fieldNameCn\":\"布控时间\",\"fieldNameEn\":\"bksj\",\"operationItem\":\"uonvOMrGRHumWqc3x\",\"fieldValueType\":3,\"fieldTargetValue\":{\"value\":\"2024-10-01\"},\"dynamicDataSourceId\":\"dds1\"},{\"sort\":0,\"type\":1,\"logic\":1,\"fieldId\":\"d2cf05f20cb844548b0252cd74cae90b\",\"groupId\":5125,\"itemName\":\"测试车辆表-数据\",\"operator\":\"=\",\"groupSort\":1,\"tableName\":\"cl\",\"dataItemId\":\"08f1489036e54d0ab38cf18ab0846146\",\"groupLogic\":1,\"fieldNameCn\":\"封锁时间\",\"fieldNameEn\":\"cfsj\",\"operationItem\":\"uqOKL3PQpDD4rZQCx\",\"fieldValueType\":3,\"fieldTargetValue\":{\"value\":\"2024-10-13\"},\"dynamicDataSourceId\":\"dds1\"}],\"statusName\":\"超期未办\",\"statusLevel\":1,\"operationItem\":\"uJPx39rC7o5sv\",\"ruleExpression\":\"(uonvOMrGRHumWqc3x) && (uqOKL3PQpDD4rZQCx)\"}]},{\"sort\":-1,\"statusId\":\"\",\"dataNodeId\":\"0de2486cd16f4bb19a5dbe1d01b876b6\",\"dataNodeName\":\"测试诗文数据5\",\"dataNodeStatuses\":[]}],\"finishAll\":true,\"processNodeId\":\"f876e1deefce443aae9d2ae52cd6fe02\",\"ruleExpression\":\"\",\"processNodeName\":\"步骤2\"}]";

        List<ProcessNodeVO> processNodeVOS = JSON.parseArray(s, ProcessNodeVO.class);
        String s1 = JSON.toJSONString(processNodeVOS);
        System.out.println(s1);
        List<ProcessNodeVO> processNodeVOS1 = JSON.parseArray(s1, ProcessNodeVO.class);
        System.out.println(processNodeVOS1);
    }
}